
export const check = (rule, data, callback) => {
  const { type: checked = false, value = '' } = data;
  let msg = '';
  if (checked) {
    const val = parseInt(value);
    if (isNaN(val)) {
      msg = '开度值必须为数字';
    } else if (val < 0 || val > 100) {
      msg = '开度值必须为0~100的数字';
    } else {}
  } else if (!value) {
    msg = '属性值不能为空';
  } else {}
  if (msg) {
    return callback(new Error(msg));
  }
  return callback();
};

import EventBus from '@/event-bus/EventBus.js';
export const bus = EventBus;

export const rcLogObjModelCode = 't_remote_control_call_log';
export const rcEquimentObjModelCode = 't_equipments_control';

export const requestFailure = { type: 'error', message: '操作失败，请检查' };
export const secondLoginFailure = { type: 'error', message: '验证不通过' };
export const tipCancel = { type: 'info', message: '已取消' };
export const defaultPwdRules = /^(?!\s)((?=.*[a-zA-Z])(?=.*[a-z])(?=.*[A-Z])(?=.*[\W_]).\S{5,31})$/;
